<template>
	<view class="shopList">
		<view class="title">
			<text>{{title}}</text>
			<view>
				<image class="title-logo" src="../../static/fire.png" mode="widthFix"></image>
			</view>
		</view>
		<view class="list">
			<scroll-view scroll-x="true" class="scroll">
				<view class="box" v-for="(item,index) in list" :key="index">
					<view class="card">
						<view class="card-top">
							<image class="card-img" :src="item.spuImg" mode="aspectFill"></image>
							<view class="zekou">
								省{{(item.spuOriginalPrice - item.spuPrice)/100}}元
							</view>
						</view>
						<view class="card-bottom">
							<view class="titles">
								{{item.spuTitle}}
							</view>
							<view class="zprice">
								<view class="price">
									<text>￥</text>
									<text>{{item.spuPrice/100}}</text>
								</view>
								<image @click="jiarugwBtn(item)" class="cart" src="../../static/card.png" mode="widthFix"></image>
							</view>
							<view class="padding-bottom-10">
								<text class="orgin">￥{{item.spuOriginalPrice/100}}</text>
							</view>
						</view>
					</view>
				</view>
			</scroll-view>
		</view>
	</view>
</template>

<script>
	import mixi from '../data/index.js'
	export default {
		mixins:[mixi],
		props: {
			title: {
				type: String,
				default: ''
			},
			list: {
				type: Array,
				default: () => []
			}
		}
	}
</script>

<style lang="scss" scoped>
	.shopList {
		width: 710rpx;
		margin: auto;
		background-color: #FFFFFF;
		border-radius: 30rpx;
		box-shadow: 5rpx 5rpx 5rpx #FFFFFF;
		padding: 20rpx 0rpx 20rpx 20rpx;
		box-sizing: border-box;

		.title {
			font-size: #333333;
			font-size: 17px;
			display: flex;
			align-content: center;

			.title-logo {
				width: 45rpx;
				margin-left: 10rpx;
			}
		}

		.list {
			width: 100%;
			display: flex;
			flex-wrap: wrap;

			.scroll {
				width: 100%;
				overflow: hidden;
				white-space: nowrap;
			}

			.box {
				width: 210rpx;
				margin: 20rpx 20rpx 20rpx 0rpx;
				display: inline-block;
				color: #808080;
				background-color: #FFFFFF;
			}

			.card {
				width: 218rpx;
				background-color: #F7F7F7;
				box-sizing: border-box;
				border-radius: 20rpx;
				overflow: hidden;

				&-top {
					position: relative;
					padding: 10rpx 10rpx 0 10rpx;

					.zekou {
						position: absolute;
						top: 0rpx;
						left: 0rpx;
						background-color: #36B542;
						padding: 10rpx 20rpx;
						border-top-left-radius: 25rpx;
						border-bottom-right-radius: 25rpx;
						color: #FFFFFF;
						font-size: 12px;
					}
				}

				&-img {
					width: 200rpx;
					height: 200rpx;
					border-radius: 20rpx;
				}

				&-bottom {
					padding: 5rpx 10rpx;

					.titles {
						font-size: 14px;
						overflow: hidden;
						white-space: nowrap;
						text-overflow: ellipsis;
						-o-text-overflow: ellipsis;
					}

					.zprice {
						margin-top: 15rpx;
						display: flex;
						justify-content: space-between;
						align-items: center;
						color: #36B542;

						.price {
							text {
								&:first-child {
									font-size: 13px;
								}

								&:nth-child(2) {
									font-size: 17px;
									font-weight: bold;
								}
							}
						}

						.cart {
							width: 50rpx;
						}
					}

					.orgin {
						color: #999999;
						font-size: 12px;
						text-decoration: line-through;
					}
				}
			}
		}

		.padding-bottom-10 {
			padding-bottom: 10rpx;
		}

		.dowm {
			padding: 30rpx 0;
			display: flex;
			justify-content: center;
			color: #666666;
			font-size: 14px;
			align-items: center;

			image {
				margin-left: 10rpx;
				width: 40rpx;
			}
		}
	}
</style>
